using System;
using System.CodeDom;
using System.Collections.Generic;
using System.IO;
using System.Text;
using NUnit.Framework;
using System.Xml.Schema;

namespace Xtee.CodeDom.Test.SimpleTypes.Writer
{
    [TestFixture]
    public class SimpleTypeWriterTest : BaseFixture
    {
        
        private string expextedDerivedSimpleType = @"..\..\SimpleTypes\Writer\Resources\DerivedSimple.cs";
        private string expextedSimpleType = @"..\..\SimpleTypes\Writer\Resources\Simple.cs";
        private string expextedSimpleDateType = @"..\..\SimpleTypes\Writer\Resources\SimpleDateTime.cs";
        private string expextedSimpleFractionDigits = @"..\..\SimpleTypes\Writer\Resources\SimpleFractionDigits.cs";
        private string expextedExtendedSimpleContent = @"..\..\SimpleTypes\Writer\Resources\ExtendedSimpleContent.cs";
        private string expextedRestrictedSimpleContent = @"..\..\SimpleTypes\Writer\Resources\RestrictedSimpleContent.cs";

        [Test]
        public void SupportingTypes() {
  
            WriteSimpleType(GetTestComplextType("FamilyMountainBikeSizes")); 
            WriteSimpleType(GetTestSimpleType("mountainbikesize"));
        }

        [Test]
        public void WriteRestrictedSimpleContentTest()
        {
            var wrapper = GetTestComplextType("RestrictedSimpleContent");
            var path = WriteSimpleType(wrapper);
            Console.WriteLine(path);
            string generated = File.ReadAllText(path);
            string expected = File.ReadAllText(expextedRestrictedSimpleContent);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected, generated);

        }

        [Test]
        public void WriteExtendedSimpleContentTest()
        {
            var wrapper = GetTestComplextType("ExtendedSimpleContent");
            string generated = File.ReadAllText(WriteSimpleType(wrapper));
            string expected = File.ReadAllText(expextedExtendedSimpleContent);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected, generated);

        }

        [Test]
        public void WriteSimpleDateTimeTypeTest()
        {
            var wrapper =  GetTestSimpleType("SimpleDateTime");
            string generated = File.ReadAllText(WriteSimpleType(wrapper));
            string expected = File.ReadAllText(expextedSimpleDateType);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected, generated);

        }
        [Test]
        public  void WriteSimpleTypeTest()
        {
            var wrapper = GetTestSimpleType("Simple");
            string generated = File.ReadAllText(WriteSimpleType(wrapper));
            string expected = File.ReadAllText(expextedSimpleType);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected,generated);
           
        }

        [Test]
        public void WriteSimpleDerivedTypeTest()
        {
            var wrapper = GetTestSimpleType("DerivedSimple");
            string generated = File.ReadAllText(WriteSimpleType(wrapper));
            string expected = File.ReadAllText(expextedDerivedSimpleType);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected, generated);
           
        }
        [Test]
        public void WriteDecimalType()
        {
            var wrapper = GetTestSimpleType("SimpleFractionDigits");
            string generated = File.ReadAllText(WriteSimpleType(wrapper));
            string expected = File.ReadAllText(expextedSimpleFractionDigits);

            Console.WriteLine(File.ReadAllText(WriteSimpleType(wrapper)));
            Assert.AreEqual(expected, generated);
            
        }

      
    }
}